{extend name='index@template/base'}{/extend}
{block name='style'}{/block}
{block name='script'}{/block}
{block name='content'}
<div class="wrapper">
    <form class="form-horizontal" id='form' action="{:url('WechatTemplateMessage/update')}">
        <div class="box-body">
            <div class="form-group">
                <label class="col-sm-3 control-label">模板名称</label>
                <div class="col-sm-6">
                    <input name="id" value="{$vo.id ?? ''}" type="hidden"/>
                    <input type="text" class="form-control" placeholder="" name="title" value="{$vo.title ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模板编号</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control"  name="template_short_id" value="{$vo.template_short_id ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模板ID</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="" name="template_id" value="{$vo.template_id ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">头部标题</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="" name="first" value="{$vo.first ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <!--<div id="type-items">-->
                <!--{if condition="array_key_exists('data',$vo)"}-->
                <!--{volist name='$vo.data' id='co'}-->
                <!--<div class="items">-->
                    <!--<div class="form-group key_item">-->
                        <!--<label class="col-sm-3 control-label must">自定义键</label>-->
                        <!--<div class="col-sm-6">-->
                            <!--<input type="text" name="tp_kw[]" class="form-control" value="{$co.key}" placeholder="键名">-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="form-group key_item">-->
                        <!--<label class="col-sm-3 control-label"></label>-->
                        <!--<div class="col-sm-3">-->
                            <!--<textarea name="tp_value[]" class="form-control" placeholder="键值">{$co.value}</textarea>-->
                        <!--</div>-->
                        <!--<div class="col-sm-1" style="padding:0">-->
                            <!--<input type="color" name="tp_color[]" value="{$co.color}" style="width:32px;height:32px;">-->
                        <!--</div>-->
                        <!--<a class="btn btn-default" href="javascript:;" onclick=$(this).closest(".items").remove()><i class="fa fa-remove"></i> 删除</a>-->
                    <!--</div>-->
                <!--</div>-->
                <!--{/volist}-->
                <!--{/if}-->


            <!--</div>-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-3 control-label"></label>-->
                <!--<div class="col-sm-6">-->
                    <!--<a class="btn btn-default btn-add-type" href="javascript:;" onclick="addType();"><i class="fa fa-plus" title=""></i> 增加一条键</a>-->
                <!--</div>-->
                <!--<div class="col-xs-3 col-ms-3"></div>-->
            <!--</div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">尾部描述</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="" name="remark" value="{$vo.remark ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">消息链接</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="" name="url" value="{$vo.url ?? ''}">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="form-group">
                <div class="col-sm-9 col-sm-offset-3">
                    <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                    <button type="button" class="btn btn-default radius ml-20" onclick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            </div>
        </div>
    </form>
</div>
{/block}
{block name='script_extra'}
<script>
    $("#form").Validform({
        tiptype: 2,
        showAllError: true,
        ajaxPost: true,
        callback: function (res) {
            if (res.success == true) {
                layer.msg(res.message, {time: 1000}, function () {
                    layer_close();
                    parent.$('#table').bootstrapTable('refresh');
                });
            }
        }
    });

    function addType() {
        var html = ' <div class="items">' +
                '<div class="form-group key_item">' +
                '<label class="col-sm-3 control-label must">自定义键</label>' +
                '<div class="col-sm-6">' +
                '<input type="text" name="tp_kw[]" class="form-control" value="" placeholder="键名">' +
                '</div>' +
                '</div>' +
                '<div class="form-group key_item">' +
                '<label class="col-sm-3 control-label"></label>' +
                '<div class="col-sm-3">' +
                '<textarea name="tp_value[]" class="form-control" placeholder="键值"></textarea>' +
                '</div>' +
                '<div class="col-sm-1" style="padding:0">' +
                '<input type="color" name="tp_color[]" value="" style="width:32px;height:32px;">' +
                '</div>' +
                '<a class="btn btn-default" href="javascript:;" onclick=$(this).closest(".items").remove()><i class="fa fa-remove"></i> 删除</a>' +
                '</div>' +
                '</div>';
        $('#type-items').append(html)
    }
</script>

{/block}